package com.tk.entity;

import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Post {
	
	private int id;
	private String title;
	private int pid;
	private Date replyTime;
	private Date lastReply;
	private String content;
	private String posterName;
	private int posterPos;
	
	public int getPosterPos() {
		return posterPos;
	}
	public void setPosterPos(int posterPos) {
		this.posterPos = posterPos;
	}
	public String getPosterName() {
		return posterName;
	}
	public void setPosterName(String posterName) {
		this.posterName = posterName;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public int getPid() {
		return pid;
	}
	public void setPid(int pid) {
		this.pid = pid;
	}
	public Date getReplyTime() {
		return replyTime;
	}
	public void setReplyTime(Date replyTime) {
		this.replyTime = replyTime;
	}
	public Date getLastReply() {
		return lastReply;
	}
	public void setLastReply(Date lastReply) {
		this.lastReply = lastReply;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	
	public Post() {
		super();
	}
	
	public Post(int id, String title, int pid, Date replyTime, Date lastReply, String content, String posterName,
			int posterPos) {
		super();
		this.id = id;
		this.title = title;
		this.pid = pid;
		this.replyTime = replyTime;
		this.lastReply = lastReply;
		this.content = content;
		this.posterName = posterName;
		this.posterPos = posterPos;
	}
	
	public Post(String title, int pid, Date replyTime, Date lastReply, String content, String posterName,
			int posterPos) {
		super();
		this.title = title;
		this.pid = pid;
		this.replyTime = replyTime;
		this.lastReply = lastReply;
		this.content = content;
		this.posterName = posterName;
		this.posterPos = posterPos;
	}
	
	public void initPostByResultSet( ResultSet rs ){
		try {
			this.setId(rs.getInt(1));
			this.setTitle(rs.getString(2));
			this.setPid(rs.getInt(3));
			this.setReplyTime(rs.getDate(4));
			this.setLastReply(rs.getDate(5));
			this.setPosterPos(rs.getInt(6));
			this.setContent(rs.getString(7));
			this.setPosterName(rs.getString(8));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
